import java.util.Scanner;

public class CarsTest {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Cars[] cars = new Cars[3];
        for(int i = 0; i<cars.length; i++){
            System.out.print("请输入车名： ");
            String car = sc.next();
            System.out.print("请输入车的颜色： ");
            String color = sc.next();
            System.out.print("请输入车的价格： ");
            int price = sc.nextInt();
            Cars cars1 = new Cars(car,color,price);
            cars[i] = cars1;
        }
        //遍历数组
        for(int i = 0; i<cars.length; i++){
            Cars cars2 = cars[i];
            System.out.println("车名：" + cars2.getName() + " 车的颜色：" + cars2.getColor() + " 车的价格：" + cars2.getPrice());
        }
    }
}
